package com.kwedding.service.app;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.kwedding.bean.TB_Demo;
import com.kwedding.dao.TB_DemoMapper;
import com.kwedding.dto.app.RequestBrandDemo;
import com.kwedding.dto.web.ResponseWebDemoList;
import com.kwedding.util.CheckedUtil;
import com.kwedding.util.Constants;
import com.kwedding.util.CopyerObject;
import com.kwedding.util.LoggerParent;

@Service
public class DemoService extends LoggerParent {
	@Autowired
	private TB_DemoMapper tb_DemoMapper;

	/**
	 * web样片列表
	 * 
	 * @param requestWebSearchName
	 * @return
	 */
	@Transactional(readOnly = true)
	public List<ResponseWebDemoList> getDemoList(RequestBrandDemo requestBrandDemo) {
		CheckedUtil.isNull(requestBrandDemo.getBrandId(), Constants.REQUEST_ERROR_1, "品牌不能为空");
		CheckedUtil.isNull(requestBrandDemo.getStyleId(), Constants.REQUEST_ERROR_2, "风格不能为空");
		List<TB_Demo> tb_Demos = tb_DemoMapper.selectDemoInUse(requestBrandDemo.getBrandId(),
				requestBrandDemo.getStyleId());
		List<ResponseWebDemoList> responseWebDemoLists = CopyerObject.copyerListObject(tb_Demos,
				ResponseWebDemoList.class);
		return responseWebDemoLists;
	}
}
